package org.endy.leisure.diaTracker.service

import org.endy.leisure.diaTracker.entity.User
import org.endy.leisure.diaTracker.entity.announcement.Announcement
import org.endy.leisure.diaTracker.entity.announcement.AnnouncementView
import org.endy.leisure.diaTracker.repository.AnnouncementViewRepository
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import java.util.Date

@SpringBootTest
class AnnouncementServiceTest {

    @Autowired
    private lateinit var announcementService: AnnouncementService

    private val userId = "1234554321"

    @Test
    fun publisher() {
        announcementService.publisher(
            Announcement(
                title = "执行提醒",
                content = "今天晚上9：00在二楼3号会议室开会",
                publisher = "主任",
                expireTime = Date(),
                user = User(id = userId)
            )
        )
    }

    @Test
    fun queryAnnouncement() {
        val list = announcementService.queryAll()
        print(list)
    }

    @Test
    fun readAnnouncement() {
        announcementService.readAnnouncement(userId,1)
    }

    @Test
    fun queryAnnouncementView(){
        val read = announcementService.queryAnnouncementStatus(userId)
        print(read)
    }

}